import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import store from './store'
import filtes from './filtes/filtes'
import lottery from './config/lottery'
import md5 from 'js-md5';
//引入vantui
import Vant from 'vant';
import 'vant/lib/index.css';

// 导入 vee-validate
import VeeValidate, { Validator } from "vee-validate";
// 导入方言包
import zh_CN from "vee-validate/dist/locale/zh_CN.js";

// 使用 vant
Vue.use(Vant);
// 使用 VeeValidate
// Vue.use(VeeValidate, {
//   events: "blur"
// });
Vue.use(VeeValidate, {
  events: "" // 禁用校验事件
});
// 使用方言包
Validator.localize("zh_CN", zh_CN);

// import "../node_modules/amfe-flexible/index"

Vue.config.productionTip = false
Vue.prototype.lottery = lottery
Vue.prototype.HOST='/api'
Vue.prototype.$md5 = md5;

router.afterEach((to,from,next) => {
  window.scrollTo(0,0);
})

Vue.filter('timeChange', function (times) {  //时间过滤器
	function add0(m){return m<10?'0'+m:m }
	let time = new Date(times);
	var m = time.getMonth()+1;
	var d = time.getDate();
	var h = time.getHours();
	var mm = time.getMinutes();
	var s = time.getSeconds();
	return add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm);
})
Vue.prototype.$filtes = filtes

// 本地环境
if (process.env.NODE_ENV == 'development') {
    Vue.prototype.keyUrl = '/api'
}else{
	Vue.prototype.keyUrl = ''
}

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
